package com.smooth.mall.common;

import com.google.common.collect.Sets;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Set;

@Component
public class Constant {
    /**
     * 描述：定义盐值常量，不能过于简单
     */
    public static final String SALT="6jhsd0=+.z/";
    /**
     * 描述：定义session中用户名常量名
     */
    public static final String SMOOTH_MALL_USER="smooth_mall_user";

    public static String FILE_UPLOAD_DIR;
    @Value("${file.upload.dir}")
    public void setFileUploadDir(String fileUploadDir){
        FILE_UPLOAD_DIR = fileUploadDir;
    }

    public interface ProductListOrderBy {
        Set<String> PRICE_ASC_DESC= Sets.newHashSet("price desc","price asc");
    }

    //定义商品上下架状态枚举接口
    public interface SaleStatus{
        int NOT_SALE=0;//商品下架状态
        int SALE=1;//商品上架状态
    }
    //定义商品被选中状态枚举接口
    public interface Cart{
        int UNCHECKED=0;//商品未选中状态
        int CHECKED=1;//商品被选中状态
    }

    public static com.smooth.mall.exception.OrderStatusEnum OrderStatusEnum;
}
